<?php
class jg extends CI_Controller {
	function index() {
		$this -> pub -> logp('智库关系', '1-2');
		$this -> load -> view('zk/jg');
	}

	function show() {
		$this -> pub -> logp('智库关系', '1-2');
		$jg['_id'] = 'mystery-of-the-secret-room';
		$jg['_rev'] = '1-058a97024fc92a7254f3d02a4fbfe7c9';
		$jg['sys']['repulsion'] = '2600';
		$jg['sys']['friction'] = '0.1';
		$jg['sys']['stiffness'] = '512';
		$jg['sys']['gravity'] = true;
		$jg['src'] = "; 关系\n";
		$this -> db -> where('mid >', 1);
		$this->db->limit(30);
		$q = $this -> db -> get_where('zk');
		$zk = $q -> result_array();
		foreach ($zk as $v) {
			$jg['src'] .= $v['fid'] . " -> " . $v['mid'] . "\n";
		}

		$jg['src'] .= "; 颜色\n1{color:#444, shape:dot, label:Lance}\n";

		$this -> db -> select('nickname,lv,pan_zk.mid,layer');
		$this -> db -> where('pan_zk.mid >', 1);
		$this -> db -> where('subscribe', 1);
		$this -> db -> join('member', 'pan_zk.mid=pan_member.mid');
		$this->db->limit(30);
		$q = $this -> db -> get_where('zk');
		$m = $q -> result_array();
		$color[] = 'c5d800';
		$color[] = '42a300';
		$color[] = 'ff9900';
		$color[] = 'bd7604';
		$color[] = '732707';
		
		$color[] = 'b1f1ff';
		$color[] = '6de0ff';
		$color[] = '079eef';
		$color[] = '0761b7';
		$color[] = '01487c';

		foreach ($m as $v) {
			$jg['src'] .= $v['mid'] . "{color:#" . $color[$v['lv']] . ",label:" . str_replace('?', '', $v['nickname']) . '(' . $v['layer'] . '-' . $v['lv'] . ')' . "}\n";
		}
		$jg['example'] = 'cyoa';
		$jg['title'] = 'Mystery of the Secret Room';
		echo json_encode($jg);
	}

}
?>